package ru.amse.baltijsky.javascheme.tree;

import ru.amse.baltijsky.javascheme.nodeshape.ActionNodeShape;
import ru.amse.baltijsky.javascheme.nodeshape.INodeShape;
import ru.amse.baltijsky.javascheme.nodeshape.NoShape;

public class CatchNode extends BranchNode {
    private boolean hasFinally;

    public CatchNode() {
    }

    public CatchNode(SchemaNode parentNode, SchemaNode prevNode) {
        super(parentNode, prevNode);
    }

    public CatchNode(SchemaNode parentNode, SchemaNode prevNode, String[] s) {
        super(parentNode, prevNode, s);
    }

    public CatchNode(String[] s) {
        super(s);
    }

    public NodeType getNodeType() {
        return NodeType.CATCH;
    }

    public INodeShape getShape() {
        return new NoShape("");
    }

    @Override
    public INodeShape getClosingShape() {
        return hasFinally ? new ActionNodeShape("finally") : new NoShape("");
    }

    public boolean isHasFinally() {
        return hasFinally;
    }

    public void setHasFinally(boolean hasFinally) {
        this.hasFinally = hasFinally;
    }
}
